Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FEAT) Demanda Insatisfecha: pasar funcionalidad a API #1893

Merged
merged 2 commits into from
Jun 18, 2024
Merged

Conversation

JuanIRamirez
Copy link
Contributor

Requerimiento

Funcionalidad desarrollada

  1. En ../routes/listaEspera.ts se modificó método post(...) para que decida si agrega un doc a la colección o una demanda al un doc. existente.
  2. en ../schemas/listaEspera.ts se agregó: 'export const demanda' para poder auditar (Auth.audit) el elemento.

UserStories llegó a completarse

  • Si
  • No

Requiere actualizaciones en la base de datos

  • Si
  • No

origen: req.body.demandas[0].origen
};

const query: any = await listaEspera.find(params, (data: any) => { return data; });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Se recomienta que las operaciones con async/await queden siempre dentro de bloques try-catch para poder manejar los errores.

try {
    const query: any = await listaEspera.find(params, (data: any) => { return data; });
    ...
    // todo el contenido del bloque
    ...
    const itemSaved = await newItem.save();  // realizar el save en este formato, al estar dentro del boque del try los posibles errores se van por el catch
    res.json(itemSaved);
}, catch (error) {
    return next(''algun mensaje de error que va a llegar al usuario');
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corregido

@negro89 negro89 added the changes requested Se solicitaron cambios label May 6, 2024
@JuanIRamirez JuanIRamirez force-pushed the CIT-268 branch 2 times, most recently from 1929aee to 38a7527 Compare May 23, 2024 14:07
@JuanIRamirez JuanIRamirez added changes done and removed changes requested Se solicitaron cambios labels May 23, 2024
@negro89 negro89 merged commit 08a3520 into master Jun 18, 2024
2 checks passed
@negro89 negro89 deleted the CIT-268 branch June 18, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants